package com.ruoyi.consumer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumer.mapper.CUserMapper;
import com.ruoyi.consumer.domain.CUser;
import com.ruoyi.consumer.service.ICUserService;

/**
 * 用户账号Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-10
 */
@Service
public class CUserServiceImpl implements ICUserService 
{
    @Autowired
    private CUserMapper cUserMapper;

    /**
     * 查询用户账号
     * 
     * @param userId 用户账号主键
     * @return 用户账号
     */
    @Override
    public CUser selectCUserByUserId(Integer userId)
    {
        return cUserMapper.selectCUserByUserId(userId);
    }

    /**
     * 查询用户账号列表
     * 
     * @param cUser 用户账号
     * @return 用户账号
     */
    @Override
    public List<CUser> selectCUserList(CUser cUser)
    {
        return cUserMapper.selectCUserList(cUser);
    }

    /**
     * 新增用户账号
     * 
     * @param cUser 用户账号
     * @return 结果
     */
    @Override
    public int insertCUser(CUser cUser)
    {
        cUser.setCreateTime(DateUtils.getNowDate());
        return cUserMapper.insertCUser(cUser);
    }

    /**
     * 修改用户账号
     * 
     * @param cUser 用户账号
     * @return 结果
     */
    @Override
    public int updateCUser(CUser cUser)
    {
        cUser.setUpdateTime(DateUtils.getNowDate());
        return cUserMapper.updateCUser(cUser);
    }

    /**
     * 批量删除用户账号
     * 
     * @param userIds 需要删除的用户账号主键
     * @return 结果
     */
    @Override
    public int deleteCUserByUserIds(Integer[] userIds)
    {
        return cUserMapper.deleteCUserByUserIds(userIds);
    }

    /**
     * 删除用户账号信息
     * 
     * @param userId 用户账号主键
     * @return 结果
     */
    @Override
    public int deleteCUserByUserId(Integer userId)
    {
        return cUserMapper.deleteCUserByUserId(userId);
    }
}
